package com.talkweb.newproject.api.model.common;

/**
 * Created by qsf on 2019/4/3.
 */
public enum Status {

    SUCCESS("SUCCESS","200"),  //成功
    MISSING("NOTFOUND","404"),   //没有找到接口
    TIMEOUT("TIMEOUT","408"),  //请求超时
    BAD_REQUEST("BAD_REQUEST","499"), //请求失败
    FAILD("FAILED","500"),
    HYSTRIX_FAILD("HYSTRIX_FAILD","501"),  //走了断路器

    /**
     * 参数错误
     */
    ERR_406("参数错误","406"),
    ERR_403("认证失效","403")
    ;

    String name;
    String value;

    Status(String name,String value) {
        this.name=name;
        this.value=value;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.getValue();
    }

    public static String toValue(Status status) {return status.getValue();}

    public static Status fromValue(String v) {return valueOf(v);}
}
